load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:defs.bzl", "cc_test")

cc_library(
    name = "logger_for_tests",
    hdrs = ["logger-for-tests.hpp"],
    visibility = ["//:__subpackages__"],
)

cc_test(
    name = "check_streams_on_exit_test",
    srcs = ["check-streams-on-exit.cpp"],
    deps = ["@boost.test//:hdrs"],
)

cc_test(
    name = "decorators_datatestcase_test",
    srcs = ["decorators-datatestcase-test.cpp"],
    deps = ["@boost.test//:unit_test_main"],
)

cc_test(
    name = "log_count_skipped_test",
    srcs = ["log-count-skipped-test.cpp"],
    args = [
        "--",
        "$(rootpath //baseline-outputs:log-count-skipped-tests.pattern)",
    ],
    data = ["//baseline-outputs:log-count-skipped-tests.pattern"],
    deps = [
        ":logger_for_tests",
        "@boost.test//:hdrs",
    ],
)

cc_test(
    name = "log_formatter_test",
    srcs = ["log-formatter-test.cpp"],
    args = [
        "--",
        "$(rootpath //baseline-outputs:log-formatter-test.pattern)",
        "$(rootpath //baseline-outputs:log-formatter-test.pattern.junit)",
        "$(rootpath //baseline-outputs:log-formatter-context-test.pattern)",
    ],
    data = [
        "//baseline-outputs:log-formatter-context-test.pattern",
        "//baseline-outputs:log-formatter-test.pattern",
        "//baseline-outputs:log-formatter-test.pattern.junit",
    ],
    deps = [
        ":logger_for_tests",
        "@boost.lexical_cast",
        "@boost.test//:unit_test_main",
    ],
)

# master-test-suite-non-copyable-test.cpp is not written in a way that works out
# of the box for a Bazel cc_test, so we skip it.

cc_test(
    name = "message_in_datatestcase_test",
    srcs = [
        "message-in-datatestcase-test.cpp",
    ],
    args = [
        "--",
        "$(rootpath //baseline-outputs:messages-in-datasets-test.pattern)",
    ],
    data = ["//baseline-outputs:messages-in-datasets-test.pattern"],
    deps = [
        ":logger_for_tests",
        "@boost.test//:unit_test_main",
    ],
)

cc_test(
    name = "result_report_test",
    srcs = ["result-report-test.cpp"],
    args = [
        "--",
        "$(rootpath //baseline-outputs:result-report-test.pattern)",
        "$(rootpath //baseline-outputs:result_report_test.pattern.default_behaviour)",
    ],
    data = [
        "//baseline-outputs:result-report-test.pattern",
        "//baseline-outputs:result_report_test.pattern.default_behaviour",
    ],
    deps = [
        ":logger_for_tests",
        "@boost.lexical_cast",
        "@boost.test//:unit_test_main",
    ],
)

cc_test(
    name = "run_by_name_or_label_test",
    srcs = ["run-by-name-or-label-test.cpp"],
    deps = ["@boost.test//:unit_test_main"],
)

# This test has memory leaks.
cc_test(
    name = "macro_global_fixture_test",
    srcs = ["test-macro-global-fixture.cpp"],
    args = [
        "--",
        "$(rootpath //baseline-outputs:global-fixtures-test.pattern)",
    ],
    data = ["//baseline-outputs:global-fixtures-test.pattern"],
    deps = [
        ":logger_for_tests",
        "@boost.lexical_cast",
        "@boost.test//:unit_test_main",
    ],
)

cc_test(
    name = "version_uses_module_name_test",
    srcs = ["version-uses-module-name.cpp"],
    deps = ["@boost.test//:hdrs"],
)
